//author:dhclly
const o =console.log;


enum DirectionInit {
    Up = 1,
    Down,
    Left,
    Right
}

enum DirectionDefault {
    Up,
    Down,
    Left,
    Right,
}

enum DirectionString {
    Up = "UP",
    Down = "DOWN",
    Left = "LEFT",
    Right = "RIGHT",
}

enum NResponse {
    No = 0,
    Yes = 1,
}

function nrespond(recipient: string, message: NResponse): void {
    // ...
}

nrespond("Princess Caroline", NResponse.Yes)

//不建议这么瞎几把搞
enum BooleanLikeHeterogeneousEnum {
    No = 0,
    Yes = "YES",
}

enum FileAccess {
    // constant members
    None,
    Read    = 1 << 1,
    Write   = 1 << 2,
    ReadWrite  = Read | Write,
    // computed member
    G = "123".length
}

enum ShapeKind {
    Circle,
    Square,
}

interface Circle {
    kind: ShapeKind.Circle;
    radius: number;
}

interface Square {
    kind: ShapeKind.Square;
    sideLength: number;
}

// let c: Circle = {
//     kind: ShapeKind.Square,
//     //    ~~~~~~~~~~~~~~~~ Error!
//     radius: 100,
// }

enum Enum {
    A
}
let a = Enum.A;
let nameOfA = Enum[a]; // "A"

const enum ConstEnum {
    A = 1,
    B = A * 2
}

let ConstEnumA = ConstEnum.A
let ConstEnumB = ConstEnum.B

//编译后就是计算结果，不存在此枚举对象
const enum Directions {
    Up,
    Down,
    Left,
    Right
}

let directions = [Directions.Up, Directions.Down, Directions.Left, Directions.Right]

